package com.smartcruise.main.selfFragment.setting.languageSetting;

import android.view.View;
import android.widget.ImageView;

import com.smartcruise.R;
import com.smartcruise.base.BaseTitleFragment;
import com.smartcruise.base.TitleBuilder;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by FengChaoQun
 * on 2018/1/20 0020
 * 语言设置界面
 */

public class LanguageSettingFragment extends BaseTitleFragment implements LanguageSettingContract.View {

    @BindView(R.id.simpleChineseCheck)
    ImageView simpleChineseCheck;
    @BindView(R.id.TibetanCheck)
    ImageView TibetanCheck;
    @BindView(R.id.weiwuerCheck)
    ImageView weiwuerCheck;
    @BindView(R.id.mengwenCheck)
    ImageView mengwenCheck;

    private LanguageSettingContract.Presenter mPresenter;

    @Override
    protected void init() {
        setCloseActivity();
        mPresenter = new LanguagePresenterImp(this);
        mPresenter.start();
    }

    @Override
    protected int getContentLayout() {
        return R.layout.fragment_contain_language_setting;
    }

    @Override
    protected TitleBuilder getTitleBuilder() {
        return TitleBuilder.create(true, getString(R.string.languageSet));
    }

    @OnClick(R.id.simpleChineseLay)
    public void onSimpleChineseLayClicked() {
        mPresenter.setLanguageChecked(0);
    }

    @OnClick(R.id.TibetanLay)
    public void onTibetanLayClicked() {
        mPresenter.setLanguageChecked(1);
    }

    @OnClick(R.id.weiwuerLay)
    public void onWeiwuerLayClicked() {
        mPresenter.setLanguageChecked(2);
    }

    @OnClick(R.id.mengwenLay)
    public void onMengwenLayClicked() {
        mPresenter.setLanguageChecked(3);
    }

    @Override
    public void showLanguageChecked(int position) {
        switch (position) {
            case 0:
                simpleChineseCheck.setVisibility(View.VISIBLE);
                TibetanCheck.setVisibility(View.INVISIBLE);
                weiwuerCheck.setVisibility(View.INVISIBLE);
                mengwenCheck.setVisibility(View.INVISIBLE);
                break;
            case 1:
                simpleChineseCheck.setVisibility(View.INVISIBLE);
                TibetanCheck.setVisibility(View.VISIBLE);
                weiwuerCheck.setVisibility(View.INVISIBLE);
                mengwenCheck.setVisibility(View.INVISIBLE);
                break;
            case 2:
                simpleChineseCheck.setVisibility(View.INVISIBLE);
                TibetanCheck.setVisibility(View.INVISIBLE);
                weiwuerCheck.setVisibility(View.VISIBLE);
                mengwenCheck.setVisibility(View.INVISIBLE);
                break;
            case 3:
                simpleChineseCheck.setVisibility(View.INVISIBLE);
                TibetanCheck.setVisibility(View.INVISIBLE);
                weiwuerCheck.setVisibility(View.INVISIBLE);
                mengwenCheck.setVisibility(View.VISIBLE);
                break;
        }
    }
}
